From 0f0ee97e1e4a835ca84de96267b25380be7de6c4 Mon Sep 17 00:00:00 2001 From: Christian Hergert Date: Thu, 18 Mar 2021 17:54:48 -0700 Subject: [PATCH] ngl: clear Glyph front cache at the beginning of a frame We don't want to be responsible for duplicating the effort of the hash table, we just want to speed up subsequent lookups. Otherwise, we risk not marking glyph usage when tracking usage for compaction. --- gsk/ngl/gsknglglyphlibrary.c | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/gsk/ngl/gsknglglyphlibrary.c b/gsk/ngl/gsknglglyphlibrary.c index 5cb2a3fe3b..bc57475c00 100644 --- a/gsk/ngl/gsknglglyphlibrary.c +++ b/gsk/ngl/gsknglglyphlibrary.c @@ -83,6 +83,16 @@ gsk_ngl_glyph_value_free (gpointer data) g_slice_free (GskNglGlyphValue, data); } +static void +gsk_ngl_glyph_library_begin_frame (GskNglTextureLibrary *library, + gint64 frame_id, + GPtrArray *removed_atlases) +{ + GskNglGlyphLibrary *self = GSK_NGL_GLYPH_LIBRARY (library); + + memset (self->front, 0, sizeof self->front); +} + static void gsk_ngl_glyph_library_finalize (GObject *object) { @@ -98,8 +108,11 @@ static void gsk_ngl_glyph_library_class_init (GskNglGlyphLibraryClass *klass) { GObjectClass *object_class = G_OBJECT_CLASS (klass); + GskNglTextureLibraryClass *library_class = GSK_NGL_TEXTURE_LIBRARY_CLASS (klass); object_class->finalize = gsk_ngl_glyph_library_finalize; + + library_class->begin_frame = gsk_ngl_glyph_library_begin_frame; } static void -- 2.30.2